/*
 * @Author: your name
 * @Date: 2021-05-24 10:16:24
 * @LastEditTime: 2021-05-24 14:37:09
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \5.24\dan\src\store\index.js
 */
import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    List: [],
  },
  mutations: {
    setstate(state, payload) {
      state[payload.key] = payload.value
    },
  },
  actions: {
    async GetList({ commit }) {
      let res = await axios.get('/api/list')
      commit('setstate', { key: 'List', value: res.data.list })
    }
  },
  modules: {
  }
})
